package com.bishe.bishe.dao.mapper;

import com.bishe.bishe.pojo.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
@Repository
public interface UserMapper {
    @Select("select * from user where user_entername = #{user.userEntername} and user_pwd=#{user.userPwd}")
    User findall(@Param("user") User user) ;

    @Insert("insert into user(user_id,user_name,user_pwd,user_entername,user_number) value(null,#{user.userName},#{user.userPwd},#{user.userEntername},#{user.userNumber})")
    int insert(@Param("user") User user);
    @Delete("delete from user where user_id=#{userid}")
    int delete(@Param("userid") int userid) ;

    @Update("update user set user_name=#{user.userName},user_pwd=#{user.userPwd},user_entername=#{user.userEntername},user_number=#{user.userNumber} where user_id=#{user.userId}")
    int update(@Param("user") User user);

    @Select("select * from user where user_id = #{userId}")
    User findUser(@Param("userId")int userid);

    @Select("select * from user")
    List<User> find();
    @Select("select * from user where user_entername = #{userEntername}")
    User checkuser(String userEntername);
}
